home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 1999 May / maximum-cd-1999-05.iso / Canvas 6 / DATA1.CAB / English_Tutorial_Files / Viewpage / ColUrl.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-11-04  |  2.1 KB  |  72 lines

  1. import java.awt.Graphics;
  2. import java.awt.Polygon;
  3. import java.awt.Rectangle;
  4. import java.io.DataInputStream;
  5. import java.io.IOException;
  6.  
  7. final class ColUrl extends ColObj {
  8.    protected Polygon m_poly;
  9.    protected String m_url = new String();
  10.    private int m_numPts;
  11.    private float[] m_ptArryX;
  12.    private float[] m_ptArryY;
  13.    private ColGrph m_colGraphicObj;
  14.    public ColObj m_linkObject;
  15.    public Rectangle m_bounds = new Rectangle();
  16.  
  17.    public void draw(Graphics var1) {
  18.       this.m_poly = new Polygon();
  19.  
  20.       for(int var2 = 0; var2 < this.m_numPts; ++var2) {
  21.          this.m_poly.addPoint((int)((this.m_ptArryX[var2] + 0.5F - this.m_colGraphicObj.m_xOrg) * this.m_colGraphicObj.m_mag), (int)((this.m_ptArryY[var2] + 0.5F - this.m_colGraphicObj.m_yOrg) * this.m_colGraphicObj.m_mag));
  22.       }
  23.  
  24.    }
  25.  
  26.    public int getType() {
  27.       return 7;
  28.    }
  29.  
  30.    public Rectangle getBounds() {
  31.       return this.m_bounds;
  32.    }
  33.  
  34.    public ColUrl(DataInputStream var1, ColGrph var2, Graphics var3) throws IOException {
  35.       this.m_colGraphicObj = var2;
  36.  
  37.       for(short var4 = var1.readShort(); var4 > 0; var4 = (short)(var4 + -1)) {
  38.          String var10001 = this.m_url;
  39.          this.m_url = var10001 + (char)var1.readByte();
  40.       }
  41.  
  42.       if (this.m_url.indexOf(":") < 0) {
  43.          if (this.m_url.indexOf("..") > -1) {
  44.             String var5;
  45.             for(var5 = new String(this.m_colGraphicObj.m_appComp.m_cvFilePath.toString()); this.m_url.indexOf("..") > -1; var5 = var5.substring(0, var5.lastIndexOf("/") + 1)) {
  46.                this.m_url = this.m_url.substring(this.m_url.indexOf("..") + 3);
  47.                var5 = var5.substring(0, var5.lastIndexOf("/"));
  48.             }
  49.  
  50.             this.m_url = var5 + this.m_url;
  51.          } else {
  52.             this.m_url = this.m_colGraphicObj.m_appComp.m_cvFilePath + this.m_url;
  53.          }
  54.       }
  55.  
  56.       this.m_numPts = var1.readInt();
  57.       this.m_ptArryX = new float[this.m_numPts];
  58.       this.m_ptArryY = new float[this.m_numPts];
  59.  
  60.       for(int var7 = 0; var7 < this.m_numPts; ++var7) {
  61.          this.m_ptArryX[var7] = (float)var1.readInt() / 65536.0F;
  62.          this.m_ptArryY[var7] = (float)var1.readInt() / 65536.0F;
  63.       }
  64.  
  65.       this.draw(var3);
  66.       this.m_bounds.x = this.m_poly.getBoundingBox().x;
  67.       this.m_bounds.y = this.m_poly.getBoundingBox().y;
  68.       this.m_bounds.width = this.m_poly.getBoundingBox().width;
  69.       this.m_bounds.height = this.m_poly.getBoundingBox().height;
  70.    }
  71. }
  72.